<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .container {
            border: 1px solid #ccc;
            width: 980px;
            margin: auto;
        }
    </style>
</head>
<body>
    <div id="app">
        <my-layout>
            <!-- 相当于一个容器 -->
            <template v-slot:header>
                <p>头部</p>
            </template>
            <template>
                <p>主体</p>
            </template>
            <template>
                <p>主体11</p>
            </template>
            <template v-slot:default>
                <p>主体22</p>
            </template>
            <template v-slot:default>
                <p>主体2aa2</p>
            </template>
            <template v-slot:footer>
                <p>底部</p>
            </template>
        </my-layout>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.js"></script>
    <script>
        Vue.component("MyLayout",{
            template: `<div class="container">
                            <div class="header">
                                <slot name="header"></slot>
                            </div>
                            <div class="body">
                                <slot></slot>
                            </div>
                            <div class="body">
                                <slot></slot>
                            </div>
                            <div class="footer">
                                <slot name="footer"></slot>
                            </div>
                        </div>`,
        })

        var vm = new Vue({
            el:"#app",
            data: {

            }
        })
    </script>
</body>
</html>